package com.ctl.szmd.szmd.feature_wm.ui.base

import androidx.databinding.ViewDataBinding
import com.ctl.lib_common.base.mvvm.BaseBindingFragment
import com.ctl.szmd.szmd.feature_wm.R
import com.gyf.immersionbar.ktx.immersionBar
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog


/**
 * created by : chentl
 * Date: 2020/07/22
 */
abstract class BaseWmBindingFragment<B : ViewDataBinding> : BaseBindingFragment<B>() {


    override fun showLoadingUI(isShow: Boolean) {

    }

    override fun showEmptyUI(isShow: Boolean) {

    }

    override fun initImmersionBar() {
        immersionBar {
            statusBarColor(R.color.colorWmRed)
            fitsSystemWindows(true)
        }
    }

    private val mQMUILoadingDialog by lazy {
        QMUITipDialog.Builder(mContext)
            .setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING)
            .create()
    }

    /**
     * 显示loading弹框
     */
    protected fun showLoading() {
        if (!mQMUILoadingDialog.isShowing) {
            mQMUILoadingDialog.show()
        }
    }

    /**
     * 关闭loading弹框
     */
    protected fun dismissLoading() {
        if (mQMUILoadingDialog.isShowing) {
            mQMUILoadingDialog.dismiss()
        }
    }

}